package com.loubobooo.personal.blog.mapper.custom;

import com.loubobooo.personal.blog.entity.vo.ArticleVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ArticleMapperCustom {
	//获取文章总数
	public Integer countArticle(@Param(value = "status") Integer status);
	
	//获得留言总数
	public Integer countArticleComment(@Param(value = "status") Integer status);
	
	//获得浏览量总数
	public Integer countArticleView(@Param(value = "status") Integer status);
	
	//获得所有文章(文章归档)
	public List<ArticleVO> listArticle(@Param(value = "status") Integer status);
	
	//根据id查询用户信息
	public ArticleVO getArticleById(@Param(value = "status") Integer status, @Param(value = "id") Integer id);
	
	//分页操作
	public List<ArticleVO> listArticleByPage(@Param(value = "status") Integer status,
            @Param(value = "startPos") Integer startPos, @Param(value = "pageSize") Integer pageSize);
	
	//文章结果查询结果的数量
	public Integer getSearchResultCount(@Param(value = "status") Integer status, @Param(value = "query") String query);
	
	//查询文章分页操作
	public List<ArticleVO> listSearchResultByPage(@Param(value = "status") Integer status,
            @Param(value = "query") String query, @Param(value = "startPos") Integer startPos,
            @Param(value = "pageSize") Integer pageSize);
	
	//获得同分类的文章(相关文章)
	public List<ArticleVO> listArticleWithSameCategory(@Param(value = "status") Integer status,
            @Param(value = "parentCategory") Integer parentCategory,
            @Param(value = "childCategory") Integer childCategory, @Param(value = "limit") Integer limit);
	
	//获得访问最多的文章(猜你喜欢)
	public List<ArticleVO> listArticleByViewCount(@Param(value = "status") Integer status,
            @Param(value = "limit") Integer limit);
	
	//获得上一篇文章
	public ArticleVO getAfterArticle(@Param(value = "status") Integer status, @Param(value = "id") Integer id);
	
	//获得下一篇文章
	public ArticleVO getPreArticle(@Param(value = "status") Integer status, @Param(value = "id") Integer id);
	
	//获得随机文章
	public List<ArticleVO> listRandomArticle(@Param(value = "status") Integer status,
            @Param(value = "limit") Integer limit);

	//热评文章
	public List<ArticleVO> listArticleByCommentCount(@Param(value = "status") Integer status,
            @Param(value = "limit") Integer limit);

	//获得该分类的文章数
	public Integer countArticleByCategory(@Param(value = "status") Integer status, @Param(value = "id") Integer id);

	//获得该分类的文章数
	public Integer countArticleByTag(@Param(value = "status") Integer status, @Param(value = "id") Integer id);

	//更新文章的评论数
	public void updateCommentCount(@Param(value = "articleId") Integer articleId);

	//获得最后更新的记录
	public ArticleVO getLastUpdateArticle();
}



